﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Nova_DAL;
using System.Data.Common;
using Nova_Common;
using Nova_BLL;


public partial class Command_TrayPosAdd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
        if (!IsPostBack)
        {
          
        }
    }


    /// <summary>
    /// 关闭子窗体
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ibtnClose_Click(object sender, ImageClickEventArgs e)
    {
        this.Page.ClientScript.RegisterStartupScript(typeof(string), "Nova", "top.close();", true);
        //ibtnClose.Attributes.Add("onclick", "javascript:top.close()");


    }

    /// <summary>
    /// 托盘位置添加操作
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ibtnOK_Click(object sender, ImageClickEventArgs e)
    {
        int ResNo;
        string strMessage;

        try
        {
            string UserName = Request.Cookies["vNovaUserNo"].Value; 
            if (string.IsNullOrEmpty(txtTrayId.Text.Trim()))
            {
                ShowBox.MessageBox(this.Page, "托盘号不能为空");
                return;
            }

            if (string.IsNullOrEmpty(txtPos_ID.Text.Trim()))
            {
                ShowBox.MessageBox(this.Page, "托盘位置不能为空");
                return;
            }

            ResNo = new Nova_BLL.TBase_Position().TrayPosAdd_ManBackUp(txtTrayId.Text.Trim(), Convert.ToInt64(txtPos_ID.Text.Trim()), UserName, out strMessage);
            
            if(ResNo==1)
            {
                ShowBox.MessageBox(this.Page, "执行成功");
                return;
            }
            else
            {
                ShowBox.MessageBox(this.Page, "执行失败："+strMessage);
                return;
            }

        }
        catch(Exception ex)
        {
            ShowBox.MessageBox(this.Page, "方法执行异常跳出");
            return;

        }

    }





}